<!DOCTYPE html>
<html>
	<head>
		<base href="{$base_name}"/>
		<meta charset="utf-8" />
		<meta content="yes" name="apple-touch-fullscreen">
		<meta content="yes" name="apple-mobile-web-app-capable">
        <meta content="telephone=no,email=no" name="format-detection">
		<script type="text/javascript" src="libs/flexible_css.js"></script>
		<script type="text/javascript" src="libs/config.js"></script>
		<script type="text/javascript" src="libs/flexible.js"></script>
		<script type="text/javascript" src="libs/jquery-1.7.2.min.js"></script>
		<script type="text/javascript" src="libs/artTemplate.js"></script>
		<script type="text/javascript" src="libs/lazyload.js"></script>
		<script type="text/javascript" src="js/index.js"></script>
		<link rel="stylesheet" type="text/css" href="css/main.css">
	</head>
	<body>
		<div id="container">
			<div class="page on">
			<div id="header">
				<div class="idx-search">
					<form action="search.html">
						<input type="text" name="keyword" placeholder="搜索平台内容" />
					</form>
				</div>
				<div class="history">
					<ul id="li"></ul>
				</div>
				<a href="#" class="idx-menu"></a>
			</div>
			<div id="main">
				<div class="lecture">
					<div class="title">
						<img src="images/index/people.gif" />
						<span>大咖讲堂</span>
						<a href="teacher.html">更多大咖>></a>
					</div>
					<div class="picscroll">
						<ul class="picsc">
							
						</ul>
					</div>
				</div>
				<div class="ranklist">
					<div class="title">
						<img src="images/index/book.gif" />
						<span>新人系列培训课堂</span>
						<a href="elite_club.html">课程目录>></a>
					</div>
					<a class="rl" href="home/rookie/index/id/7.html">
						<div class="directory">第一阶段</div>
						<div class="course">第一周:为什么加入WV</div>
					</a>
					<div class="no"></div>
				</div>
			
				
			</div>
			<volist name="list" id="vo" key="k">
				<eq name="k" value="1">
				<volist name="vo['class_list']" id="class_list">
				<div class="elite-club">
					<div class="title">
						<img src="{$class_list.img}" />
						<span>{$class_list.cname}</span>
						<a href="{:U('home/class/index',array('id'=>$class_list['id']))}">查看更多>></a>
					</div>
					<div class="el" data-class="{$class_list.id}">
						
					</div>
				</div>
				</volist>
				</eq>
			</volist>
			</div>
			<div class="page">
			<div class="rank">
				<div class="title">
					<img src="images/index/gold.gif" />
					<span>排行榜</span>
				</div>
				<div class="r-list">
					<a href="goodcourse.html" class="r-list-1"><img src="images/index/keb.gif" /></a>
					<a href="devote.html" class="r-list-2"><img src="images/index/gxb.gif" /></a>
					<a href="study.html" class="r-list-3"><img src="images/index/hxb.gif" /></a>
				</div>
				<div class="no"></div>
			</div>
			<volist name="list" id="vo" key="k">
				<eq name="k" value="2">
				<volist name="vo['class_list']" id="class_list">
				<div class="elite-club">
					<div class="title">
						<img src="{$class_list.img}" />
						<span>{$class_list.cname}</span>
						<a href="{:U('home/class/index',array('id'=>$class_list['id']))}">查看更多>></a>
					</div>
					<div class="el" data-class="{$class_list.id}">
						
					</div>
				</div>
				</volist>
				</eq>
			</volist>
				

			</div>
			<div id="blank"></div>
			<ul id="tab">
			<volist name="list" id="vo" key="k">
				<li class="t-{$k} <eq name="k" value="1">cur</eq>">&nbsp;{$vo.name}</li>
			</volist>
			</ul>
		</div>
		

		<script type="text/html" id="scrollpic">
			<li>
				<a href="{{url}}">
					<img class="lazy" src="http://www.gbtags.com/gb/laitu/194x250&text=hello,zhiyou/ffffff" data-original="{{img}}">
					<div class="mc">
						<span class="m-1">{{type}} {{name}}</span>
						<span class="m-2">{{remark}}</span>
					</div>
				</a>
			</li>
		</script>
	</body>
</html>

<script id="classtmpl" type="text/html">
<div class="title">
	<img src="{{ d.img }}" />
	<span>{{ d.name }}</span>
	<a href="{{ d.url }}">课程目录>></a>
</div>
<a class="rl" href="{{ d.title_2_url }}">
	<div class="directory">{{ d.title_1 }}</div>
	<div class="course">{{ d.title_2 }}</div>
</a>
<div class="no"></div>
</script>
<script id="tmpl" type="text/html">
	{{#  if(d.is_hot == 1){ d.class_num = 'fever'; }}
	{{#  } }}
	{{#  if(d.is_hot == 0){ d.class_num = ''; }}
	{{#  } }} 
	<a href="javascript:void(0)" data-url="{{ d.url }}" data-id="{{ d.id }}" class="el-1">
		<div class="msg">
			<div class="heading">{{ d.title }}</div>
			<div class="amount {{ d.class_num }}">
				<p>{{ d.uname }}</p>
				<p>阅读：{{ d.read_num }}</p>
				<p>分享：{{ d.share_num }}</p>
			</div>
		</div>
		<img src="http://www.gbtags.com/gb/laitu/200x124&text=hello,zhiyou/ffffff" data-original="{{ d.img }}">
	</a>
</script>
<script src="./layui/laytpl.js"></script>
<script>
function get_json_page(){
	$.getJSON(root+'/cat/index/', function(data){
		
		var dt = data.data;
		var len = dt.length;
		var gettpl = $('#tmpl').html();
		for(var i = 0;i<len;i++){
			
			laytpl(gettpl).render(dt[i], function(html){
				$('[data-class="'+dt[i].class_id+'"]').append(html);
			});
		}
		
		$("img[data-original]").lazyload();
		
	});
	//$.getJSON(root+'/class/rookie_class/', function(data){
		//alert(data.data.length);
		//var dt_class = data.class;
		
		//var classtmpl = $('#classtmpl').html();
		//laytpl(classtmpl).render(dt_class, function(html){
		//	$('.ranklist').append(html);
		//});
		
	//});
}

var cur_num = 0;
//删除所有li
//$('.page .elite-club').remove();
get_json_page();

	
// 数组去重
	Array.prototype.unique1 = function(){
		var n = []; 
		for(var i = 0; i < this.length; i++) 
		{
		if (n.indexOf(this[i]) == -1) n.push(this[i]);
	}
	return n;
}

	

$('form input').focus(function(){
	if(localStorage.keywords){

	}else{
		return false;
	}
	localStorage.keywords=decodeURIComponent(localStorage.keywords);
	keywords = localStorage.keywords;

	//读取ls
	var keywordsarry=keywords.split(",");
	ka=keywordsarry.unique1();
	kaa=ka.reverse();
	s='';
	var num = kaa.length>3?3:kaa.length;
	for(var i=0;i<num;i++){
		
		s +="<li class='lt'>"+kaa[i]+"</li><hr/>"
	}

	s +="<li style='text-align:center' id='clear'>清除历史记录</li><hr/>"
	
	$("#li li").remove();
	$("#li").append(s);
	$(".history").show();
	
	// console.log(localStorage.keywords);

});

$('.lt').live('click',function(){
	$('input').val($(this).html());
	$(".history").hide();
	$('#li hr').remove();
})
$('#clear').live('click',function(){
	localStorage.clear();
	$('.lt').remove();
	$(".history").hide();
})


</script>
<script>
$('[data-url]').live('click',function(){
	var addurl = root + '/class/add_readnum/?id='+$(this).attr('data-id');
	var url = $(this).attr('data-url');
	$.getJSON(addurl, function(data){
		
		location.href = url;
		return false;
	});
});
</script>